<div class="page-sidebar-wrapper">
    <div class="page-sidebar navbar-collapse collapse">
        <ul class="page-sidebar-menu  page-header-fixed " data-keep-expanded="false" data-auto-scroll="true"
            data-slide-speed="200" style="padding-top: 20px">
            <li class="sidebar-toggler-wrapper hide">
                <div class="sidebar-toggler">
                    <span></span>
                </div>
            </li>
            <li class="nav-item" id="company">
                <a href="/company" class="nav-link nav-toggle">
                    <i class="icon-bulb"></i>
                    <span class="title">company</span>
                </a>
            </li>
            <li class="nav-item" id="department">
                <a href="/department" class="nav-link nav-toggle">
                    <i class="icon-wallet"></i>
                    <span class="title">department</span>
                </a>
            </li>
            <li class="nav-item" id="entity">
                <a href="/entity" class="nav-link nav-toggle">
                    <i class="icon-wallet"></i>
                    <span class="title">entity</span>
                </a>
            </li>
        </ul>
    </div>
</div>
<script>
    $(function () {
        var arr = [
            "entity", "department", "company"
        ];
        var url = window.location.href.replace(window.location.host,"");

        for (var i in arr) {
            $("#" + arr[i]).removeClass("active");
        }

        if (url.indexOf("department") > -1) { // 判斷url中是否存在department，lionel
            $("#department").addClass("active");
        }
        else if(url.indexOf("company") > -1) {
            $("#company").addClass("active");
        }
        else if(url.indexOf("entity") > -1) {
            $("#entity").addClass("active");
        }
        else{
            $("#company1").addClass("active"); // 默認焦點在company上
        }

    })
</script>